package com.woniuxy.microcurrentserver.service.impl;

import com.woniuxy.bean.current.PageInfos;
import com.woniuxy.microcurrentserver.dao.CurrentOrderDao;
import com.woniuxy.bean.current.MemberCurrentAccount;
import com.woniuxy.microcurrentserver.service.OrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
/**

* @author ：陈酒

* @date ：Created in 2021/4/17

* @description：订单服务类

* @modified By：

* @version: 1.0

*/


@Service("OrderService")
public class OrderServiceImpl implements OrderService {


    @Resource
    private CurrentOrderDao currentOrderDao;

    /**
     * class:
     * create by: 陈酒
     * description:新增订单
     * create time: 2021/4/17
     *
     * @param:
     */
    @Override
    public boolean insertOrder(PageInfos pageInfos) {
        int i = currentOrderDao.insertOrder(pageInfos.getName(),pageInfos.getCode(),pageInfos.getFundNum());
        return i>0;
    }

    /**
     * class:
     * create by: 陈酒
     * description:
     * create time: 2021/4/17
     *
     * @param:a
     */
    @Override
    public List<MemberCurrentAccount> getUserCurrentInfo(String memberAccount) {


        return  currentOrderDao.getUserCurrentInfo(memberAccount);
    }

    /**
     * class:
     * create by: 陈酒
     * description:确认是否已有业务
     * create time: 2021/4/17
     *
     * @param:a
     */
    @Override
    public MemberCurrentAccount checkMember(String code, String name) {
        MemberCurrentAccount memberCurrentAccount = currentOrderDao.checkMember(code, name);
        return memberCurrentAccount;
    }

    /**
     * class:
     * create by: 陈酒
     * description:业务复买
   * create time: 2021/4/17
     *
     * @param:a
     */
    @Override
    public int updateFundNum(PageInfos pageInfos) {
        currentOrderDao.updateFundNum(pageInfos);
        return 0;
    }

    @Override
    public void setFundNumZero(String code, String name) {
        currentOrderDao.setFundNumZero(code,name);
    }
}
